package net.sx.minemodule.mvp.item;

import android.view.View;

import com.homegoods.classify.model.Constant;
import com.homegoods.resource.HomeGoodsApp;
import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.mvp.BaseItem;

import net.sx.minemodule.R;
import net.sx.minemodule.mvp.bean.GoodCollectBean;

/**
 * @author 11470
 */
public class GoodCollectItem extends BaseItem<GoodCollectBean> {

    public GoodCollectItem(GoodCollectBean data, MultiTypeAdapter adapter) {
        super(data);
        setOnClickListener(v -> {
            if (adapter.getOnItemClickListener() != null) {
                adapter.getOnItemClickListener().onItemClicked(v, this);
            }
        });
        setOnLongClickListener(v -> {
            if (adapter.getOnItemLongClickListener() != null) {
                adapter.getOnItemLongClickListener().onItemLongClicked(v, this);
            }
            return true;
        });
    }

    @Override
    public int getLayout() {
        return R.layout.mine_item_good_collect;
    }

    public String getImgPath() {

        return /*HomeGoodsApp.getOSSHost() + "/" +*/ getData().getProductPic();
    }

    public String getGoodName() {
        return getData().getProductName();
    }

    public String getPrice() {
        return String.format("￥%s", getData().getProductPrice());
    }

    @Override
    public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        super.setOnLongClickListener(onLongClickListener);
    }
}
